package com.hrc.springbootdemo.freemarker;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Date;

@Controller
public class HelloController {

    @GetMapping("/hello")
    public String sayHello(Model model) {
        model.addAttribute("message", "Hello, Spring Boot with FreeMarker!");
        model.addAttribute("date", new Date());
        // 指向 templates/hello.ftl
        return "hello";
    }
}